package com.harassment.interception.ui.activities.main;

import android.content.Context;
import android.content.Intent;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.view.MenuItem;

import com.harassment.interception.R;

public class RecordShowActivity extends AppCompatActivity {
    private static final String TAG = "RecordShowActivity";
    private Toolbar mToolbar;
    private RecyclerView mRecyclerView;

    public static void startRecordShowActivity(Context context){
        Intent intent = new Intent(context, RecordShowActivity.class);
        context.startActivity(intent);
    }
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_record_show);
        initActionBar();
        mRecyclerView = findViewById(R.id.base_recycler_view);
        mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
        mRecyclerView.addItemDecoration(new DividerItemDecoration(this,DividerItemDecoration.VERTICAL));
        mRecyclerView.setAdapter(new RecordListAdapter());
    }

    private void initActionBar() {
        if (mToolbar == null) {
            mToolbar = findViewById(R.id.base_action_bar);
        }
        super.setSupportActionBar(mToolbar);
        ActionBar actionBar = getSupportActionBar();
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setTitle(R.string.record);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        boolean result = false;
        switch (item.getItemId()) {
            case android.R.id.home:
                result = true;
                finish();
                break;
        }
        return result;
    }
}
